package org.zjx.test.tasks;

import org.zjx.task.RetryTask;
import org.zjx.context.ChainContext;
import org.zjx.task.core.TaskScheduler;

public class RetryTask2 extends RetryTask {

    public RetryTask2() {
        super("retryTask2");
    }

    @Override
    public void execute(ChainContext context, TaskScheduler scheduler) throws Exception {
        Thread.sleep(1000);
        System.out.println("RetryTask2 start/retry:"+getRetryCount());
        if (getRetryCount() < getMaxRetries()) {
            throw new Exception("Retry2 test failure");
        }
        System.out.println("RetryTask2 end");
    }
}
